//
//  SelectUserTableViewCell.m
//  YCSearchDemo
//
//  Created by huyuchen on 2018/3/3.
//  Copyright © 2018年 Hyc. All rights reserved.
//

#import "SelectUserTableViewCell.h"

@interface SelectUserTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *avatarIcon;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIButton *teleButton;
@property (weak, nonatomic) IBOutlet UILabel *positionLabel;
@property (weak, nonatomic) IBOutlet UIButton *statusButton;

@end
@implementation SelectUserTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self showArrowWithImage:nil];
    [self showBottomLineWithPaddingX:15 color:nil];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setGatherStatus:(BOOL)hasGather {
    self.statusButton.selected = hasGather;
}

- (void)setModel:(SelectUserInfoModel *)model {
    _model = model;
    [self.avatarIcon sd_setImageWithURL:[NSURL URLWithString:model.face_img1] placeholderImage:ImageNamed_bb(@"app_picture_default_img")];
    self.nameLabel.text = model.type == 0 ? model.username : model.visitor_name;
    self.positionLabel.text = model.type == 0 ? model.job : @"访客";
    if ([model.seqid isKindOfClass:[NSString class]] && model.seqid.length > 0 && ![model.seqid isEqualToString:@"0"]) {
        [self setGatherStatus:YES];
    }
    else {
        [self setGatherStatus:NO];
    }
    [self.teleButton setTitle:model.mobile forState:UIControlStateNormal];
}

@end
